<template>
	<view>
		
		<camera device-position="back" mode="scanCode" bindscancode="scancode" flash="off" binderror="error" style="width: 100%; height: 300px;"></camera>
		<button type="primary" @click="takePhoto">拍照</button>
		<view>预览</view>
		<image mode="widthFix" :src="src"></image>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				src:null
			}
		},
		methods: {
			takePhoto:function() {
			    wx.scanCode({
			      success (res) {
			        console.log(res)
			      }
			    })
			  },
			error:function(e) {
			    console.log(e.detail)
			  },
			scancode:function(e){
				  console.log(e.detail)
			  }

		},
		onLoad() {
			//查询登陆状态
			this.checkLogin();
		}
	}
</script>

<style>

</style>
